#include "sUnRegister.h"

#include <sstream>
#include <Poco/DOM/Document.h>
#include <Poco/DOM/NodeIterator.h>
#include "misc/Interface.h"
#include "misc/Debug.h"
#include "server/net/sRegister.h"
#include "server/net/NetworkControl.h"
/*********************************************************/
void sUnRegister::execute()
{
	// The server only sends unregister messages so we do nothing here
}
/*********************************************************/
std::string sUnRegister::serialize() const
{
	NetworkControl& ns = NetworkControl::Instance();
	std::ostringstream		ostr;

	ostr << "<GS id='" << ns.getID() << "'>";
	ostr << "<UnRegister>";
	ostr << "<hostaddr>" << hostAddr << "</hostaddr>";
	ostr << "<ringname>" << ringName << "</ringname>";
	ostr << "</UnRegister>";
	ostr << "</GS>";

	return( ostr.str() );
}
/*********************************************************/
void sUnRegister::deserialize(Poco::XML::NodeIterator& it)
{
	// This message is only sent by the server, not received
}
/*********************************************************/
void sUnRegister::setRingName(const std::string& name)
{
	ringName = name;
}
/*********************************************************/
void sUnRegister::setHostAddr(const std::string& addr)
{
	hostAddr = addr;
}
/*********************************************************/
std::string sUnRegister::getRingName() const
{
	return ringName;
}
/*********************************************************/
std::string sUnRegister::getHostAddr() const
{
	return hostAddr;
}
/*********************************************************/
